package com.weiaibenpao.demo.chislim.ui.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.widget.TextView;

import com.weiaibenpao.demo.chislim.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/1/10.
 */

public class MomentActionDialog extends Dialog {

    public static final String ACTION_DELETE = "删除";
    public static final String ACTION_REPORT = "举报";
    private String action;


    public MomentActionDialog(@NonNull Context context, String action) {
        super(context);
        this.action = action;
    }

    @BindView(R.id.tv_action)
    TextView tvAction;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_moment_action_dialog);
        ButterKnife.bind(this);
        tvAction.setText(action);
    }


    @OnClick(R.id.tv_action)
    public void onClick() {
        dismiss();
        if (onActionClickListener != null) {
            onActionClickListener.onActionClicked(action);
        }
    }

    public void setOnActionClickListener(OnActionClickListener listener) {
        onActionClickListener = listener;
    }

    private OnActionClickListener onActionClickListener;

    public interface OnActionClickListener {
        void onActionClicked(String action);
    }

}
